################################################################################################################
# Multiple Imputation of m=5 Datasets for Additional Analyses in Appendix
set.seed(1234)
imp <- mice(data[,c("edu_high", "religiosity", "leftright")], method="pmm")

# First Imputation
imp.data.1 <- complete(imp, 1)
imp.data.1 <- cbind(data, imp.data.1)
imp.data.1$leftright <- imp.data.1[,213]
imp.data.1$religiosity <- imp.data.1[,212]
imp.data.1$edu_high <- imp.data.1[,211]

m <- lm(rel_feel ~  rel_deserv + rel_vote + rel_office + rel_banperm + liberal + rel_muslim + rel_dev + rel_rad + rel_immigrant + fem + age + edu_high + religiosity + leftright, data=imp.data.1)
imp.data.1 <- m$model

# Second Imputation
imp.data.2 <- complete(imp, 2)
imp.data.2 <- cbind(data, imp.data.2)
imp.data.2$leftright <- imp.data.2[,213]
imp.data.2$religiosity <- imp.data.2[,212]
imp.data.2$edu_high <- imp.data.2[,211]

m <- lm(rel_feel ~  rel_deserv + rel_vote + rel_office + rel_banperm + liberal + rel_muslim + rel_dev + rel_rad + rel_immigrant + fem + age + edu_high + religiosity + leftright, data=imp.data.2)
imp.data.2 <- m$model

# Three Imputation
imp.data.3 <- complete(imp, 3)
imp.data.3 <- cbind(data, imp.data.3)
imp.data.3$leftright <- imp.data.3[,213]
imp.data.3$religiosity <- imp.data.3[,212]
imp.data.3$edu_high <- imp.data.3[,211]

m <- lm(rel_feel ~  rel_deserv + rel_vote + rel_office + rel_banperm + liberal + rel_muslim + rel_dev + rel_rad + rel_immigrant + fem + age + edu_high + religiosity + leftright, data=imp.data.3)
imp.data.3 <- m$model

# Fourth Imputation
imp.data.4 <- complete(imp, 4)
imp.data.4 <- cbind(data, imp.data.4)
imp.data.4$leftright <- imp.data.4[,213]
imp.data.4$religiosity <- imp.data.4[,212]
imp.data.4$edu_high <- imp.data.4[,211]

m <- lm(rel_feel ~  rel_deserv + rel_vote + rel_office + rel_banperm + liberal + rel_muslim + rel_dev + rel_rad + rel_immigrant + fem + age + edu_high + religiosity + leftright, data=imp.data.4)
imp.data.4 <- m$model

# Fifth Imputation
imp.data.5 <- complete(imp, 5)
imp.data.5 <- cbind(data, imp.data.5)
imp.data.5$leftright <- imp.data.5[,213]
imp.data.5$religiosity <- imp.data.5[,212]
imp.data.5$edu_high <- imp.data.5[,211]

m <- lm(rel_feel ~  rel_deserv + rel_vote + rel_office + rel_banperm + liberal + rel_muslim + rel_dev + rel_rad + rel_immigrant + fem + age + edu_high + religiosity + leftright, data=imp.data.5)
imp.data.5 <- m$model

###################################################################################################